import 'package:logger/logger.dart';

class ReportSdkConfig {
  static DateTime systemNow() {
    return DateTime.now();
  }

  final String serverUrl;
  final String userId;
  final DateTime Function() now;
  final int batchSize;
  final int retentionDays;
  final Duration debounce;
  final bool isCleanOldData;
  final Duration timeout;
  final Duration batchTimeout;
  final Duration retryInterval;
  final Map<String, String> headers;
  final Logger? logger;

  ReportSdkConfig({
    required this.serverUrl,
    required this.userId,
    this.now = systemNow,
    this.debounce = const Duration(seconds: 10), //单位秒
    this.batchSize = 25,
    this.retentionDays = 7,
    this.isCleanOldData = false,
    this.timeout = const Duration(seconds: 30),
    this.batchTimeout = const Duration(seconds: 5),
    this.retryInterval = const Duration(seconds: 1),
    this.headers = const {},
    this.logger,
  }) {
    i = this;
  }

  static late ReportSdkConfig i;
}
